<#import '/ftlLibrary/properteisVariable.ftl' as pv/>
<link href="assets/css/bootstrap-select.css" rel="stylesheet"/>
<link href="assets/css/front/listCommonStyle.css" rel="stylesheet"/>
<script src="assets/js/select2/select2.js"></script>
<style>
    .bootbox-close-button {
        width: 19px;
        height: 19px;
        border: none;
        cursor: pointer;
        -webkit-appearance: none;
        float: right;
        top: 4px;
        left: -5px;
        position: relative;
        background: #E9F5FF url("assets/img/nav-img/icon_close.png") no-repeat 0 0;
    }

    .attendClassList .modal-dialog {
        width: 80% !important;
    }

    .modal-content {
        width: 100%;
    }

    input, select, .form-control {
        height: 30px;
    }

    .myDialogDetail label {
        margin-bottom: 0px !important;
    }

    th,td{
        height: 34.29px!important;
    }
    .detailDialogStyle {
        line-height: 30px;
        margin-bottom: 15px;
    }
    .myDialogDetail1 .modal-body{
        padding-bottom: 0px!important;
        border-bottom-right-radius: 5px!important;
        border-bottom-left-radius: 5px!important;
    }
</style>
<div class="row padding-left-10 padding-right-10">
    <input type="hidden" name="memberPackageId" class="memberPackageId" value="${memberPackageId}"/>
    <!-- 映射列表 -->
    <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12" id="leftTree">

        <div class="widget flat searchCriteria clearfix">
            <form id="${searchFormId}" action="${actionUrl}" method="POST" style="margin-bottom: 0px!important;">
                <div class="row searchInput" style="margin: 0;">
                    <label style="margin-bottom: 15px;margin-right: 40px;">
                        <label style="width: 78px">课程日期：</label>
                        <label>
                            <input type="text" name="startTime_begin" value="${search_map.startTime_begin[0]}"
                                   style="width: 89px;height: 30px;border: 1px solid #c6d5d8;border-radius: 4px !important;">
                            至
                            <input type="text" name="startTime_end" value="${search_map.startTime_end[0]}"
                                   style="width: 89px;height: 30px;border: 1px solid #c6d5d8;border-radius: 4px !important;">
                        </label>
                    </label>
                    <label style="margin-bottom: 15px;margin-right: 40px;">
                        <label style="width: 78px">课程体系：</label>
                        <label>
                            <select class="form-select-1 systemPid" name="startTimes"
                                    style="width: 160px;height: 30px;border: 1px solid #c6d5d8;border-radius: 4px !important;" >
                                <option>请选择课程体系</option>
                            </select><select class="form-select-1 courseId" name="courseId"
                                             style="width: 160px;height: 30px;border: 1px solid #c6d5d8;border-radius: 4px !important;" >
                            <option>请选择课程名称</option>
                        </select>
                        </label>
                    </label>

                    <label style="margin-bottom: 15px;margin-right: 40px;">
                        <label style="width: 78px">上课教室：</label>
                        <label>
                            <label>
                                <select class="form-select-1" name="roomId" id="roomId"
                                        style="
                                    width:160px;height: 30px;border: 1px solid #c6d5d8;border-radius: 4px !important;"
                                        value="">
                                </select>
                            </label>
                        </label>
                    </label>
                    <label style="margin-bottom: 15px;margin-right: 40px;">
                        <label style="width: 78px">上课时间：</label>
                        <label>
                            <input type="text" name="startTime_begin" value="${search_map.startTime_begin[0]}"
                                   style="width: 89px;height: 30px;border: 1px solid #c6d5d8;border-radius: 4px !important;">
                            至
                            <input type="text" name="startTime_end" value="${search_map.startTime_end[0]}"
                                   style="width: 89px;height: 30px;border: 1px solid #c6d5d8;border-radius: 4px !important;">
                        </label>
                    </label>
                    <label style="margin-bottom: 15px;margin-right: 40px;">
                        <label style="width: 78px">周几上课：</label>
                        <label>
                            <select class="form-select-1" style="width: 200px;height: 30px;border: 1px solid #c6d5d8;border-radius: 4px !important;" name="weekDay" >
                                <@dictionary groupCode="weekDay";dics>
                                <#list dics as dic>
                                <option value="${dic.code}">${dic.value}</option>
                            </#list>
                        </@dictionary>
                        </select>
                    </label>
                    </label>
                    <label style="margin-bottom: 15px;margin-right: 40px;">
                        <label style="width: 78px">授课老师：</label>
                        <label>
                            <select class="form-select-1" name="adminUserId" id="adminUserId"
                                    style="
                                    width:160px;height: 30px;border: 1px solid #c6d5d8;border-radius: 4px !important;" >
                            </select>
                        </label>
                    </label>
                    <label style="margin-bottom: 15px;">
                        <button style="border-radius: 0px;border: none;background: #ffab00 !important;"
                                class="btn btn-warning shiny search margin-right-10"><i class="fa fa-search"></i>搜索
                        </button>
                    </label>
                </div>
            </form>
        </div>
        <div class="widget flat radius-bordered" style="margin-top: 0;box-shadow:0px 0px 10px rgba(122,161,184,0.3);">
            <div class="widget-body no-padding ">
                <div class="topPagingBar hidden"> ${pagingBar}</div>
                <div class="table-scrollable" style="border: none;" id="tableScrollable">
                    <!-- 数据表列信息列表 -->
                    <table class="table table-hover dataTable newtable">
                        <thead>
                        <tr>
                            <th title="选择" class="checkboxColumnTh">
                                <div class="checkbox">
                                    <label>
                                        <input type="checkbox" class="chkAll">
                                        <span class="text"></span> </label>
                                </div>
                            </th>
                            <th title="属性名">序号</th>
                            <th title="课程名称">课程名称</th>
                            <th title="开始日期">开始日期</th>
                            <th title="结束日期">结束日期</th>
                            <th title="周几上课">周几上课</th>
                            <th title="开始时间">开始时间</th>
                            <th title="截止时间">结束时间</th>
                            <th title="上课教室Id">上课教室</th>
                            <th title="授课老师Id">授课老师</th>
                            <th title="单节考勤天数">单节考勤天数</th>
                        </tr>
                        </thead>
                        <tbody>
                        <#if page_bean.list?size==0>
                            <tr>
                                <td align="center">无数据</td>
                            </tr>
                        </#if>
                        <#list page_bean.list as data>
                            <tr>
                                <td class="checkboxColumnTd">
                                    <div class="checkbox">
                                        <label>
                                            <input type="checkbox" class="chk" name="classId" value="${data.id}">
                                            <span class="text"></span> </label>
                                    </div>
                                </td>
                                <td>${data_index+1+(page_bean.pageNo-1)*page_bean.pageSize}</td>
                                <td>${(data.tssCourse.pidEntity.name???string(data.tssCourse.pidEntity.name?html,"未设置"))!'未设置'}</td>
                                <td>${(data.startDate???string(data.startDate?html,"未设置"))!'未设置'}</td>
                                <td>${(data.startDate???string(data.startDate?html,"未设置"))!'未设置'}</td>
                                <td><@dictionary groupCode="weekDay" dictionaryCode="${data.weekDay}" ;weekDay>${weekDay.value }</@dictionary></td>
                                <td>${(data.startTime???string(data.startTime?html,"未设置"))!'未设置'}</td>
                                <td>${(data.endTime???string(data.endTime?html,"未设置"))!'未设置'}</td>
                                <td>${(data.tssClassRoom.name???string(data.tssClassRoom.name?html,"未设置"))!'未设置'}</td>
                                <td>${(data.empSysAdminUser.name???string(data.empSysAdminUser.name?html,"未设置"))!'未设置'}</td>
                                <td>${(data.expendClassHour???string(data.expendClassHour?html,"未设置"))!'未设置'}</td>
                            </tr>
                        </#list>
                        </tbody>

                    </table>
                </div>
                ${pagingBar}
            </div>
        </div>

        <div class="col-sm-12 text-align-center">
            <button style="width: 80px;margin-right: 20px" type="button" class="btn btn-blue" serializeNum="${serializeNum}"
                    targetdataId="${data.id}" onclick="showDialogAttendClass(this)">确定
            </button>
            <input style="width: 80px;" type="button" class="btn btn-blue" data-dismiss="modal" value="取消"/>
        </div>


    </div>
</div>
<script>
    $(".selectpicker").select2();

    function showDialogAttendClass(that) {
        var serializeNum = $(that).attr("serializeNum");
        var checkedIds = getCheckedInputValues("classId");
        var memberPackageId = $(".memberPackageId").val();
        if (checkedIds) {

        } else {
            alert("请选择要分配的客户!");
            return;
        }
        ajaxRequest("tssClassesLessonsController/getListByClassId.do", {
            serializeNum: serializeNum,
            classId: checkedIds,
            memberPackageId:memberPackageId
        }, function (html) {
            getTopWin().bootbox.dialog({
                message: html,
                title: "过度报班",
                className: 'myDialog'
            });
        }, function () {
            ajaxError("加载页面失败!")
        }, "get", "html")
    }
</script>
<script>
    $(function(){
        /**
         * 获取教师
         */
        ajaxRequest("sysAdminUserController/getPostListByDuty.do",{
            duty:3
        }, function (result) {
            var data=result.data;
            var arr=['']; //<option value="0">请选择</option>
            for (var i = 0; i< data.length; i++) {
                arr.push('<option value="'+data[i].id+'">'+data[i].realName+'</option>')
            }
            $("#adminUserId").html(arr.join(''))
        },function(){
            ajaxError("加载员工信息失败");
        }, "post","json");

        /**
         * 获取教室
         */
        ajaxRequest("tssClassRoomController/getClassRoomList.do",null, function (result) {
            var data=result.data;
            var arr=['']; //<option value="0">请选择</option>
            for (var i = 0; i< data.length; i++) {
                arr.push('<option value="'+data[i].id+'">'+data[i].name+'</option>')
            }
            $("#roomId").html(arr.join(''))
        },function(){
            ajaxError("加载教室信息失败");
        }, "post","json");

    });
    $(".selectpicker_879F8B4CDB164BA094410DA4BE75D179").select2();
    $("#editForm_879F8B4CDB164BA094410DA4BE75D179").bind("ajaxSubmitCallback", function (event, result) {
        if (result.resCode == 200) {
            alert("保存成功");
            bootbox.hideAll();
        }
    });
</script>
<script>

    /**
     * 获取课程体系
     */
    $(function(){
        ajaxRequest("tssCourseController/queryGroupBySystemPid.do",{
            type:1
        }, function (result) {
            var data=result.data;
            var arr=['<option value="0">请选择</option>'];
            $.each(data,function(i,t){
                arr.push('<option value="'+t.systemPid+'">'+t.name+'</option>')
            })
            $(".systemPid").html(arr.join(''))
        },function(){
            ajaxError("加载课程体系失败");
        }, "post","json")
    });

    /**
     * 获取课程体系下课程名称
     */
    $(".systemPid").change(function(){
        var nowSelectedProvince=$(this).val();
        ajaxRequest("tssCourseController/queryListBySystemPid.do", {
            systemPid: nowSelectedProvince,
            type:1
        }, function (result) {
            var data=result.data;
            var arr=['<option value="0">请选择</option>'];
            $.each(data,function(i,t){
                arr.push('<option value="'+t.id+'">'+t.name+'</option>')
            })
            $(".courseId").html(arr.join(''))

        }, function () {
            ajaxError("加载课程名称失败")
        }, "post", "json")
    });

</script>